{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'C:\\\\Users\\\\Isaac\\\\Documents\\\\miniconda3\\\\envs\\\\3dvision\\\\python.exe'"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import sys\n",
    "sys.executable"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [],
   "source": [
    "import argparse\n",
    "import math\n",
    "import h5py\n",
    "import numpy as np\n",
    "import tensorflow as tf\n",
    "import socket\n",
    "\n",
    "import os\n",
    "import sys\n",
    "BASE_DIR = os.path.dirname(os.getcwd())\n",
    "BASE_DIR = os.path.join(BASE_DIR, \"Pointnet_Semantic_Segmentation\" )\n",
    "sys.path.append(BASE_DIR)\n",
    "sys.path.append(os.path.join(BASE_DIR, 'utils'))\n",
    "sys.path.append(os.path.join(BASE_DIR, 'data'))\n",
    "import provider\n",
    "import tf_util\n",
    "from model import *\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [],
   "source": [
    "BATCH_SIZE = 24\n",
    "NUM_POINT = 4096\n",
    "MAX_EPOCH = 50\n",
    "BASE_LEARNING_RATE = 0.001\n",
    "GPU_INDEX = 0\n",
    "MOMENTUM = 0.9\n",
    "OPTIMIZER = 'adam'\n",
    "DECAY_STEP = 300000\n",
    "DECAY_RATE = 0.5\n",
    "\n",
    "LOG_DIR = 'log'\n",
    "if not os.path.exists(LOG_DIR): os.mkdir(LOG_DIR)\n",
    "os.system('cp model.py %s' % (LOG_DIR)) # bkp of model def\n",
    "os.system('cp train.py %s' % (LOG_DIR)) # bkp of train procedure\n",
    "LOG_FOUT = open(os.path.join(LOG_DIR, 'log_train.txt'), 'w')\n",
    "# LOG_FOUT.write(str(FLAGS)+'\\n')\n",
    "\n",
    "MAX_NUM_POINT = 4096\n",
    "NUM_CLASSES = 13\n",
    "\n",
    "BN_INIT_DECAY = 0.5\n",
    "BN_DECAY_DECAY_RATE = 0.5\n",
    "#BN_DECAY_DECAY_STEP = float(DECAY_STEP * 2)\n",
    "BN_DECAY_DECAY_STEP = float(DECAY_STEP)\n",
    "BN_DECAY_CLIP = 0.99\n",
    "\n",
    "HOSTNAME = socket.gethostname()\n",
    "\n",
    "ALL_FILES = provider.getDataFiles('./data/indoor3d_sem_seg_hdf5_data/all_files.txt')\n",
    "room_filelist = [line.rstrip() for line in open('./data/indoor3d_sem_seg_hdf5_data/room_filelist.txt')]\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['indoor3d_sem_seg_hdf5_data/ply_data_all_0.h5',\n",
       " 'indoor3d_sem_seg_hdf5_data/ply_data_all_1.h5',\n",
       " 'indoor3d_sem_seg_hdf5_data/ply_data_all_2.h5',\n",
       " 'indoor3d_sem_seg_hdf5_data/ply_data_all_3.h5',\n",
       " 'indoor3d_sem_seg_hdf5_data/ply_data_all_4.h5',\n",
       " 'indoor3d_sem_seg_hdf5_data/ply_data_all_5.h5',\n",
       " 'indoor3d_sem_seg_hdf5_data/ply_data_all_6.h5',\n",
       " 'indoor3d_sem_seg_hdf5_data/ply_data_all_7.h5',\n",
       " 'indoor3d_sem_seg_hdf5_data/ply_data_all_8.h5',\n",
       " 'indoor3d_sem_seg_hdf5_data/ply_data_all_9.h5',\n",
       " 'indoor3d_sem_seg_hdf5_data/ply_data_all_10.h5',\n",
       " 'indoor3d_sem_seg_hdf5_data/ply_data_all_11.h5',\n",
       " 'indoor3d_sem_seg_hdf5_data/ply_data_all_12.h5',\n",
       " 'indoor3d_sem_seg_hdf5_data/ply_data_all_13.h5',\n",
       " 'indoor3d_sem_seg_hdf5_data/ply_data_all_14.h5',\n",
       " 'indoor3d_sem_seg_hdf5_data/ply_data_all_15.h5',\n",
       " 'indoor3d_sem_seg_hdf5_data/ply_data_all_16.h5',\n",
       " 'indoor3d_sem_seg_hdf5_data/ply_data_all_17.h5',\n",
       " 'indoor3d_sem_seg_hdf5_data/ply_data_all_18.h5',\n",
       " 'indoor3d_sem_seg_hdf5_data/ply_data_all_19.h5',\n",
       " 'indoor3d_sem_seg_hdf5_data/ply_data_all_20.h5',\n",
       " 'indoor3d_sem_seg_hdf5_data/ply_data_all_21.h5',\n",
       " 'indoor3d_sem_seg_hdf5_data/ply_data_all_22.h5',\n",
       " 'indoor3d_sem_seg_hdf5_data/ply_data_all_23.h5']"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ALL_FILES"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(23585, 4096, 9)\n",
      "(23585, 4096)\n"
     ]
    }
   ],
   "source": [
    "# Load ALL data\n",
    "data_batch_list = []\n",
    "label_batch_list = []\n",
    "for h5_filename in ALL_FILES:\n",
    "    data_batch, label_batch = provider.loadDataFile(\"./data/\"+h5_filename)\n",
    "    data_batch_list.append(data_batch)\n",
    "    label_batch_list.append(label_batch)\n",
    "data_batches = np.concatenate(data_batch_list, 0)\n",
    "label_batches = np.concatenate(label_batch_list, 0)\n",
    "print(data_batches.shape)\n",
    "print(label_batches.shape)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "x_range : -0.5 0.5\n",
      "y_range : -0.5 0.5\n",
      "z_range : 0.0 2.94\n",
      "r_range : 0.0 1.0\n",
      "g_range : 0.0 1.0\n",
      "b_range : 0.0 1.0\n",
      "xn_range : 0.0 1.0\n",
      "yn_range : 0.0 1.0\n",
      "zn_range : 0.0 1.0\n"
     ]
    }
   ],
   "source": [
    "features = [\"x\",\"y\",\"z\",\"r\",\"g\",\"b\",\"xn\",\"yn\",\"zn\"]\n",
    "for i in range(9): \n",
    "    print(features[i] + \"_range :\", np.min(data_batch[:, :, i]), np.max(data_batch[:, :, i]))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['Area_1_conferenceRoom_1',\n",
       " 'Area_1_conferenceRoom_1',\n",
       " 'Area_1_conferenceRoom_1',\n",
       " 'Area_1_conferenceRoom_1',\n",
       " 'Area_1_conferenceRoom_1',\n",
       " 'Area_1_conferenceRoom_1',\n",
       " 'Area_1_conferenceRoom_1',\n",
       " 'Area_1_conferenceRoom_1',\n",
       " 'Area_1_conferenceRoom_1',\n",
       " 'Area_1_conferenceRoom_1',\n",
       " 'Area_1_conferenceRoom_1',\n",
       " 'Area_1_conferenceRoom_1',\n",
       " 'Area_1_conferenceRoom_1',\n",
       " 'Area_1_conferenceRoom_1',\n",
       " 'Area_1_conferenceRoom_1',\n",
       " 'Area_1_conferenceRoom_1',\n",
       " 'Area_1_conferenceRoom_1',\n",
       " 'Area_1_conferenceRoom_1',\n",
       " 'Area_1_conferenceRoom_1',\n",
       " 'Area_1_conferenceRoom_1',\n",
       " 'Area_1_conferenceRoom_1',\n",
       " 'Area_1_conferenceRoom_1',\n",
       " 'Area_1_conferenceRoom_1',\n",
       " 'Area_1_conferenceRoom_1',\n",
       " 'Area_1_conferenceRoom_1',\n",
       " 'Area_1_conferenceRoom_1',\n",
       " 'Area_1_conferenceRoom_1',\n",
       " 'Area_1_conferenceRoom_1',\n",
       " 'Area_1_conferenceRoom_1',\n",
       " 'Area_1_conferenceRoom_1',\n",
       " 'Area_1_conferenceRoom_1',\n",
       " 'Area_1_conferenceRoom_1',\n",
       " 'Area_1_conferenceRoom_1',\n",
       " 'Area_1_conferenceRoom_1',\n",
       " 'Area_1_conferenceRoom_1',\n",
       " 'Area_1_conferenceRoom_1',\n",
       " 'Area_1_conferenceRoom_1',\n",
       " 'Area_1_conferenceRoom_1',\n",
       " 'Area_1_conferenceRoom_1',\n",
       " 'Area_1_conferenceRoom_1',\n",
       " 'Area_1_conferenceRoom_1',\n",
       " 'Area_1_conferenceRoom_1',\n",
       " 'Area_1_conferenceRoom_1',\n",
       " 'Area_1_conferenceRoom_1',\n",
       " 'Area_1_conferenceRoom_1',\n",
       " 'Area_1_conferenceRoom_1',\n",
       " 'Area_1_conferenceRoom_1',\n",
       " 'Area_1_conferenceRoom_1',\n",
       " 'Area_1_conferenceRoom_1',\n",
       " 'Area_1_conferenceRoom_1',\n",
       " 'Area_1_conferenceRoom_1',\n",
       " 'Area_1_conferenceRoom_1',\n",
       " 'Area_1_conferenceRoom_1',\n",
       " 'Area_1_conferenceRoom_1',\n",
       " 'Area_1_conferenceRoom_1',\n",
       " 'Area_1_conferenceRoom_1',\n",
       " 'Area_1_conferenceRoom_1',\n",
       " 'Area_1_conferenceRoom_1',\n",
       " 'Area_1_conferenceRoom_1',\n",
       " 'Area_1_conferenceRoom_1',\n",
       " 'Area_1_conferenceRoom_1',\n",
       " 'Area_1_conferenceRoom_1',\n",
       " 'Area_1_conferenceRoom_1',\n",
       " 'Area_1_conferenceRoom_1',\n",
       " 'Area_1_conferenceRoom_1',\n",
       " 'Area_1_conferenceRoom_1',\n",
       " 'Area_1_conferenceRoom_1',\n",
       " 'Area_1_conferenceRoom_1',\n",
       " 'Area_1_conferenceRoom_1',\n",
       " 'Area_1_conferenceRoom_1',\n",
       " 'Area_1_conferenceRoom_1',\n",
       " 'Area_1_conferenceRoom_1',\n",
       " 'Area_1_conferenceRoom_1',\n",
       " 'Area_1_conferenceRoom_1',\n",
       " 'Area_1_conferenceRoom_1',\n",
       " 'Area_1_conferenceRoom_1',\n",
       " 'Area_1_conferenceRoom_1',\n",
       " 'Area_1_conferenceRoom_1',\n",
       " 'Area_1_conferenceRoom_1',\n",
       " 'Area_1_conferenceRoom_1',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_conferenceRoom_2',\n",
       " 'Area_1_copyRoom_1',\n",
       " 'Area_1_copyRoom_1',\n",
       " 'Area_1_copyRoom_1',\n",
       " 'Area_1_copyRoom_1',\n",
       " 'Area_1_copyRoom_1',\n",
       " 'Area_1_copyRoom_1',\n",
       " 'Area_1_copyRoom_1',\n",
       " 'Area_1_copyRoom_1',\n",
       " 'Area_1_copyRoom_1',\n",
       " 'Area_1_copyRoom_1',\n",
       " 'Area_1_copyRoom_1',\n",
       " 'Area_1_copyRoom_1',\n",
       " 'Area_1_copyRoom_1',\n",
       " 'Area_1_copyRoom_1',\n",
       " 'Area_1_copyRoom_1',\n",
       " 'Area_1_copyRoom_1',\n",
       " 'Area_1_copyRoom_1',\n",
       " 'Area_1_copyRoom_1',\n",
       " 'Area_1_copyRoom_1',\n",
       " 'Area_1_copyRoom_1',\n",
       " 'Area_1_copyRoom_1',\n",
       " 'Area_1_copyRoom_1',\n",
       " 'Area_1_copyRoom_1',\n",
       " 'Area_1_copyRoom_1',\n",
       " 'Area_1_copyRoom_1',\n",
       " 'Area_1_copyRoom_1',\n",
       " 'Area_1_copyRoom_1',\n",
       " 'Area_1_copyRoom_1',\n",
       " 'Area_1_copyRoom_1',\n",
       " 'Area_1_copyRoom_1',\n",
       " 'Area_1_copyRoom_1',\n",
       " 'Area_1_copyRoom_1',\n",
       " 'Area_1_copyRoom_1',\n",
       " 'Area_1_copyRoom_1',\n",
       " 'Area_1_copyRoom_1',\n",
       " 'Area_1_hallway_1',\n",
       " 'Area_1_hallway_1',\n",
       " 'Area_1_hallway_1',\n",
       " 'Area_1_hallway_1',\n",
       " 'Area_1_hallway_1',\n",
       " 'Area_1_hallway_1',\n",
       " 'Area_1_hallway_1',\n",
       " 'Area_1_hallway_1',\n",
       " 'Area_1_hallway_1',\n",
       " 'Area_1_hallway_1',\n",
       " 'Area_1_hallway_1',\n",
       " 'Area_1_hallway_1',\n",
       " 'Area_1_hallway_1',\n",
       " 'Area_1_hallway_1',\n",
       " 'Area_1_hallway_1',\n",
       " 'Area_1_hallway_1',\n",
       " 'Area_1_hallway_1',\n",
       " 'Area_1_hallway_1',\n",
       " 'Area_1_hallway_1',\n",
       " 'Area_1_hallway_1',\n",
       " 'Area_1_hallway_1',\n",
       " 'Area_1_hallway_1',\n",
       " 'Area_1_hallway_1',\n",
       " 'Area_1_hallway_1',\n",
       " 'Area_1_hallway_1',\n",
       " 'Area_1_hallway_1',\n",
       " 'Area_1_hallway_1',\n",
       " 'Area_1_hallway_1',\n",
       " 'Area_1_hallway_1',\n",
       " 'Area_1_hallway_1',\n",
       " 'Area_1_hallway_1',\n",
       " 'Area_1_hallway_1',\n",
       " 'Area_1_hallway_2',\n",
       " 'Area_1_hallway_2',\n",
       " 'Area_1_hallway_2',\n",
       " 'Area_1_hallway_2',\n",
       " 'Area_1_hallway_2',\n",
       " 'Area_1_hallway_2',\n",
       " 'Area_1_hallway_2',\n",
       " 'Area_1_hallway_2',\n",
       " 'Area_1_hallway_2',\n",
       " 'Area_1_hallway_2',\n",
       " 'Area_1_hallway_2',\n",
       " 'Area_1_hallway_2',\n",
       " 'Area_1_hallway_2',\n",
       " 'Area_1_hallway_2',\n",
       " 'Area_1_hallway_2',\n",
       " 'Area_1_hallway_2',\n",
       " 'Area_1_hallway_2',\n",
       " 'Area_1_hallway_2',\n",
       " 'Area_1_hallway_2',\n",
       " 'Area_1_hallway_2',\n",
       " 'Area_1_hallway_2',\n",
       " 'Area_1_hallway_2',\n",
       " 'Area_1_hallway_2',\n",
       " 'Area_1_hallway_2',\n",
       " 'Area_1_hallway_2',\n",
       " 'Area_1_hallway_2',\n",
       " 'Area_1_hallway_2',\n",
       " 'Area_1_hallway_2',\n",
       " 'Area_1_hallway_2',\n",
       " 'Area_1_hallway_2',\n",
       " 'Area_1_hallway_2',\n",
       " 'Area_1_hallway_2',\n",
       " 'Area_1_hallway_2',\n",
       " 'Area_1_hallway_2',\n",
       " 'Area_1_hallway_2',\n",
       " 'Area_1_hallway_2',\n",
       " 'Area_1_hallway_2',\n",
       " 'Area_1_hallway_2',\n",
       " 'Area_1_hallway_2',\n",
       " 'Area_1_hallway_2',\n",
       " 'Area_1_hallway_2',\n",
       " 'Area_1_hallway_2',\n",
       " 'Area_1_hallway_3',\n",
       " 'Area_1_hallway_3',\n",
       " 'Area_1_hallway_3',\n",
       " 'Area_1_hallway_3',\n",
       " 'Area_1_hallway_3',\n",
       " 'Area_1_hallway_3',\n",
       " 'Area_1_hallway_3',\n",
       " 'Area_1_hallway_3',\n",
       " 'Area_1_hallway_3',\n",
       " 'Area_1_hallway_3',\n",
       " 'Area_1_hallway_3',\n",
       " 'Area_1_hallway_3',\n",
       " 'Area_1_hallway_3',\n",
       " 'Area_1_hallway_3',\n",
       " 'Area_1_hallway_3',\n",
       " 'Area_1_hallway_3',\n",
       " 'Area_1_hallway_3',\n",
       " 'Area_1_hallway_3',\n",
       " 'Area_1_hallway_3',\n",
       " 'Area_1_hallway_3',\n",
       " 'Area_1_hallway_3',\n",
       " 'Area_1_hallway_3',\n",
       " 'Area_1_hallway_3',\n",
       " 'Area_1_hallway_3',\n",
       " 'Area_1_hallway_3',\n",
       " 'Area_1_hallway_3',\n",
       " 'Area_1_hallway_3',\n",
       " 'Area_1_hallway_3',\n",
       " 'Area_1_hallway_3',\n",
       " 'Area_1_hallway_3',\n",
       " 'Area_1_hallway_3',\n",
       " 'Area_1_hallway_3',\n",
       " 'Area_1_hallway_4',\n",
       " 'Area_1_hallway_4',\n",
       " 'Area_1_hallway_4',\n",
       " 'Area_1_hallway_4',\n",
       " 'Area_1_hallway_4',\n",
       " 'Area_1_hallway_4',\n",
       " 'Area_1_hallway_4',\n",
       " 'Area_1_hallway_4',\n",
       " 'Area_1_hallway_4',\n",
       " 'Area_1_hallway_4',\n",
       " 'Area_1_hallway_4',\n",
       " 'Area_1_hallway_4',\n",
       " 'Area_1_hallway_4',\n",
       " 'Area_1_hallway_4',\n",
       " 'Area_1_hallway_4',\n",
       " 'Area_1_hallway_4',\n",
       " 'Area_1_hallway_4',\n",
       " 'Area_1_hallway_4',\n",
       " 'Area_1_hallway_4',\n",
       " 'Area_1_hallway_4',\n",
       " 'Area_1_hallway_4',\n",
       " 'Area_1_hallway_4',\n",
       " 'Area_1_hallway_4',\n",
       " 'Area_1_hallway_4',\n",
       " 'Area_1_hallway_4',\n",
       " 'Area_1_hallway_5',\n",
       " 'Area_1_hallway_5',\n",
       " 'Area_1_hallway_5',\n",
       " 'Area_1_hallway_5',\n",
       " 'Area_1_hallway_5',\n",
       " 'Area_1_hallway_5',\n",
       " 'Area_1_hallway_5',\n",
       " 'Area_1_hallway_5',\n",
       " 'Area_1_hallway_5',\n",
       " 'Area_1_hallway_5',\n",
       " 'Area_1_hallway_5',\n",
       " 'Area_1_hallway_5',\n",
       " 'Area_1_hallway_5',\n",
       " 'Area_1_hallway_5',\n",
       " 'Area_1_hallway_5',\n",
       " 'Area_1_hallway_5',\n",
       " 'Area_1_hallway_5',\n",
       " 'Area_1_hallway_5',\n",
       " 'Area_1_hallway_5',\n",
       " 'Area_1_hallway_5',\n",
       " 'Area_1_hallway_5',\n",
       " 'Area_1_hallway_5',\n",
       " 'Area_1_hallway_5',\n",
       " 'Area_1_hallway_5',\n",
       " 'Area_1_hallway_5',\n",
       " 'Area_1_hallway_5',\n",
       " 'Area_1_hallway_5',\n",
       " 'Area_1_hallway_5',\n",
       " 'Area_1_hallway_5',\n",
       " 'Area_1_hallway_5',\n",
       " 'Area_1_hallway_5',\n",
       " 'Area_1_hallway_5',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_6',\n",
       " 'Area_1_hallway_7',\n",
       " 'Area_1_hallway_7',\n",
       " 'Area_1_hallway_7',\n",
       " 'Area_1_hallway_7',\n",
       " 'Area_1_hallway_7',\n",
       " 'Area_1_hallway_7',\n",
       " 'Area_1_hallway_7',\n",
       " 'Area_1_hallway_7',\n",
       " 'Area_1_hallway_7',\n",
       " 'Area_1_hallway_7',\n",
       " 'Area_1_hallway_7',\n",
       " 'Area_1_hallway_7',\n",
       " 'Area_1_hallway_7',\n",
       " 'Area_1_hallway_7',\n",
       " 'Area_1_hallway_7',\n",
       " 'Area_1_hallway_7',\n",
       " 'Area_1_hallway_7',\n",
       " 'Area_1_hallway_7',\n",
       " 'Area_1_hallway_7',\n",
       " 'Area_1_hallway_7',\n",
       " 'Area_1_hallway_7',\n",
       " 'Area_1_hallway_7',\n",
       " 'Area_1_hallway_7',\n",
       " 'Area_1_hallway_7',\n",
       " 'Area_1_hallway_7',\n",
       " 'Area_1_hallway_7',\n",
       " 'Area_1_hallway_7',\n",
       " 'Area_1_hallway_7',\n",
       " 'Area_1_hallway_7',\n",
       " 'Area_1_hallway_7',\n",
       " 'Area_1_hallway_7',\n",
       " 'Area_1_hallway_7',\n",
       " 'Area_1_hallway_7',\n",
       " 'Area_1_hallway_7',\n",
       " 'Area_1_hallway_7',\n",
       " 'Area_1_hallway_7',\n",
       " 'Area_1_hallway_7',\n",
       " 'Area_1_hallway_7',\n",
       " 'Area_1_hallway_7',\n",
       " 'Area_1_hallway_7',\n",
       " 'Area_1_hallway_7',\n",
       " 'Area_1_hallway_7',\n",
       " 'Area_1_hallway_7',\n",
       " 'Area_1_hallway_7',\n",
       " 'Area_1_hallway_7',\n",
       " 'Area_1_hallway_7',\n",
       " 'Area_1_hallway_7',\n",
       " 'Area_1_hallway_7',\n",
       " 'Area_1_hallway_7',\n",
       " 'Area_1_hallway_7',\n",
       " 'Area_1_hallway_7',\n",
       " 'Area_1_hallway_7',\n",
       " 'Area_1_hallway_7',\n",
       " 'Area_1_hallway_7',\n",
       " 'Area_1_hallway_7',\n",
       " 'Area_1_hallway_7',\n",
       " 'Area_1_hallway_7',\n",
       " 'Area_1_hallway_7',\n",
       " 'Area_1_hallway_7',\n",
       " 'Area_1_hallway_7',\n",
       " 'Area_1_hallway_7',\n",
       " 'Area_1_hallway_7',\n",
       " 'Area_1_hallway_7',\n",
       " 'Area_1_hallway_7',\n",
       " 'Area_1_hallway_7',\n",
       " 'Area_1_hallway_7',\n",
       " 'Area_1_hallway_7',\n",
       " 'Area_1_hallway_7',\n",
       " 'Area_1_hallway_7',\n",
       " 'Area_1_hallway_7',\n",
       " 'Area_1_hallway_7',\n",
       " 'Area_1_hallway_7',\n",
       " 'Area_1_hallway_7',\n",
       " 'Area_1_hallway_7',\n",
       " 'Area_1_hallway_7',\n",
       " 'Area_1_hallway_7',\n",
       " 'Area_1_hallway_7',\n",
       " 'Area_1_hallway_7',\n",
       " 'Area_1_hallway_7',\n",
       " 'Area_1_hallway_7',\n",
       " 'Area_1_hallway_7',\n",
       " 'Area_1_hallway_7',\n",
       " 'Area_1_hallway_7',\n",
       " 'Area_1_hallway_7',\n",
       " 'Area_1_hallway_7',\n",
       " 'Area_1_hallway_7',\n",
       " 'Area_1_hallway_7',\n",
       " 'Area_1_hallway_7',\n",
       " 'Area_1_hallway_7',\n",
       " 'Area_1_hallway_7',\n",
       " 'Area_1_hallway_7',\n",
       " 'Area_1_hallway_7',\n",
       " 'Area_1_hallway_7',\n",
       " 'Area_1_hallway_7',\n",
       " 'Area_1_hallway_7',\n",
       " 'Area_1_hallway_7',\n",
       " 'Area_1_hallway_7',\n",
       " 'Area_1_hallway_7',\n",
       " 'Area_1_hallway_7',\n",
       " 'Area_1_hallway_7',\n",
       " 'Area_1_hallway_7',\n",
       " 'Area_1_hallway_7',\n",
       " 'Area_1_hallway_7',\n",
       " 'Area_1_hallway_7',\n",
       " 'Area_1_hallway_7',\n",
       " 'Area_1_hallway_7',\n",
       " 'Area_1_hallway_7',\n",
       " 'Area_1_hallway_7',\n",
       " 'Area_1_hallway_7',\n",
       " 'Area_1_hallway_7',\n",
       " 'Area_1_hallway_7',\n",
       " 'Area_1_hallway_7',\n",
       " 'Area_1_hallway_7',\n",
       " 'Area_1_hallway_7',\n",
       " 'Area_1_hallway_7',\n",
       " 'Area_1_hallway_7',\n",
       " ...]"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "room_filelist"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "23585"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "len(room_filelist)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(20291, 4096, 9) (20291, 4096)\n",
      "(3294, 4096, 9) (3294, 4096)\n"
     ]
    }
   ],
   "source": [
    "test_area = 'Area_'+str(6)\n",
    "train_idxs = []\n",
    "test_idxs = []\n",
    "for i,room_name in enumerate(room_filelist):\n",
    "    if test_area in room_name:\n",
    "        test_idxs.append(i)\n",
    "    else:\n",
    "        train_idxs.append(i)\n",
    "\n",
    "## seperate train and test data\n",
    "train_data = data_batches[train_idxs,...]\n",
    "train_label = label_batches[train_idxs]\n",
    "test_data = data_batches[test_idxs,...]\n",
    "test_label = label_batches[test_idxs]\n",
    "\n",
    "print(train_data.shape, train_label.shape)\n",
    "print(test_data.shape, test_label.shape)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Tensor(\"fc2/Relu:0\", shape=(24, 128), dtype=float32, device=/device:GPU:0)\n",
      "**** EPOCH 000 ****\n",
      "----\n",
      "Current batch/total batch num: 0/845\n",
      "Current batch/total batch num: 100/845\n",
      "Current batch/total batch num: 200/845\n",
      "Current batch/total batch num: 300/845\n",
      "Current batch/total batch num: 400/845\n",
      "Current batch/total batch num: 500/845\n",
      "Current batch/total batch num: 600/845\n",
      "Current batch/total batch num: 700/845\n",
      "Current batch/total batch num: 800/845\n",
      "mean loss: 0.702116\n",
      "accuracy: 0.772028\n",
      "----\n",
      "eval mean loss: 0.596886\n",
      "eval accuracy: 0.796427\n",
      "eval avg class acc: 0.580015\n",
      "Model saved in file: log\\model.ckpt\n",
      "**** EPOCH 001 ****\n",
      "----\n",
      "Current batch/total batch num: 0/845\n",
      "Current batch/total batch num: 100/845\n",
      "Current batch/total batch num: 200/845\n",
      "Current batch/total batch num: 300/845\n",
      "Current batch/total batch num: 400/845\n",
      "Current batch/total batch num: 500/845\n",
      "Current batch/total batch num: 600/845\n",
      "Current batch/total batch num: 700/845\n",
      "Current batch/total batch num: 800/845\n",
      "mean loss: 0.509343\n",
      "accuracy: 0.828530\n",
      "----\n",
      "eval mean loss: 0.601329\n",
      "eval accuracy: 0.796344\n",
      "eval avg class acc: 0.602350\n",
      "**** EPOCH 002 ****\n",
      "----\n",
      "Current batch/total batch num: 0/845\n",
      "Current batch/total batch num: 100/845\n",
      "Current batch/total batch num: 200/845\n",
      "Current batch/total batch num: 300/845\n",
      "Current batch/total batch num: 400/845\n",
      "Current batch/total batch num: 500/845\n",
      "Current batch/total batch num: 600/845\n",
      "Current batch/total batch num: 700/845\n",
      "Current batch/total batch num: 800/845\n",
      "mean loss: 0.445041\n",
      "accuracy: 0.848205\n",
      "----\n",
      "eval mean loss: 0.551653\n",
      "eval accuracy: 0.815381\n",
      "eval avg class acc: 0.595403\n",
      "**** EPOCH 003 ****\n",
      "----\n",
      "Current batch/total batch num: 0/845\n",
      "Current batch/total batch num: 100/845\n",
      "Current batch/total batch num: 200/845\n",
      "Current batch/total batch num: 300/845\n",
      "Current batch/total batch num: 400/845\n",
      "Current batch/total batch num: 500/845\n",
      "Current batch/total batch num: 600/845\n",
      "Current batch/total batch num: 700/845\n",
      "Current batch/total batch num: 800/845\n",
      "mean loss: 0.400806\n",
      "accuracy: 0.862671\n",
      "----\n",
      "eval mean loss: 0.521178\n",
      "eval accuracy: 0.829735\n",
      "eval avg class acc: 0.664896\n",
      "**** EPOCH 004 ****\n",
      "----\n",
      "Current batch/total batch num: 0/845\n",
      "Current batch/total batch num: 100/845\n",
      "Current batch/total batch num: 200/845\n",
      "Current batch/total batch num: 300/845\n",
      "Current batch/total batch num: 400/845\n",
      "Current batch/total batch num: 500/845\n",
      "Current batch/total batch num: 600/845\n",
      "Current batch/total batch num: 700/845\n",
      "Current batch/total batch num: 800/845\n",
      "mean loss: 0.364908\n",
      "accuracy: 0.873591\n",
      "----\n",
      "eval mean loss: 0.527118\n",
      "eval accuracy: 0.829089\n",
      "eval avg class acc: 0.658318\n",
      "**** EPOCH 005 ****\n",
      "----\n",
      "Current batch/total batch num: 0/845\n",
      "Current batch/total batch num: 100/845\n",
      "Current batch/total batch num: 200/845\n",
      "Current batch/total batch num: 300/845\n",
      "Current batch/total batch num: 400/845\n",
      "Current batch/total batch num: 500/845\n",
      "Current batch/total batch num: 600/845\n",
      "Current batch/total batch num: 700/845\n",
      "Current batch/total batch num: 800/845\n",
      "mean loss: 0.344432\n",
      "accuracy: 0.880694\n",
      "----\n",
      "eval mean loss: 0.519351\n",
      "eval accuracy: 0.832823\n",
      "eval avg class acc: 0.713742\n",
      "**** EPOCH 006 ****\n",
      "----\n",
      "Current batch/total batch num: 0/845\n",
      "Current batch/total batch num: 100/845\n",
      "Current batch/total batch num: 200/845\n"
     ]
    }
   ],
   "source": [
    "\n",
    "def log_string(out_str):\n",
    "    LOG_FOUT.write(out_str+'\\n')\n",
    "    LOG_FOUT.flush()\n",
    "    print(out_str)\n",
    "\n",
    "\n",
    "def get_learning_rate(batch):\n",
    "    learning_rate = tf.train.exponential_decay(\n",
    "                        BASE_LEARNING_RATE,  # Base learning rate.\n",
    "                        batch * BATCH_SIZE,  # Current index into the dataset.\n",
    "                        DECAY_STEP,          # Decay step.\n",
    "                        DECAY_RATE,          # Decay rate.\n",
    "                        staircase=True)\n",
    "    learning_rate = tf.maximum(learning_rate, 0.00001) # CLIP THE LEARNING RATE!!\n",
    "    return learning_rate        \n",
    "\n",
    "def get_bn_decay(batch):\n",
    "    bn_momentum = tf.train.exponential_decay(\n",
    "                      BN_INIT_DECAY,\n",
    "                      batch*BATCH_SIZE,\n",
    "                      BN_DECAY_DECAY_STEP,\n",
    "                      BN_DECAY_DECAY_RATE,\n",
    "                      staircase=True)\n",
    "    bn_decay = tf.minimum(BN_DECAY_CLIP, 1 - bn_momentum)\n",
    "    return bn_decay\n",
    "\n",
    "def train():\n",
    "    with tf.Graph().as_default():\n",
    "        with tf.device('/gpu:'+str(GPU_INDEX)):\n",
    "            pointclouds_pl, labels_pl = placeholder_inputs(BATCH_SIZE, NUM_POINT)\n",
    "            is_training_pl = tf.placeholder(tf.bool, shape=())\n",
    "            \n",
    "            # Note the global_step=batch parameter to minimize. \n",
    "            # That tells the optimizer to helpfully increment the 'batch' parameter for you every time it trains.\n",
    "            batch = tf.Variable(0)\n",
    "            bn_decay = get_bn_decay(batch)\n",
    "            tf.summary.scalar('bn_decay', bn_decay)\n",
    "\n",
    "            # Get model and loss \n",
    "            pred = get_model(pointclouds_pl, is_training_pl, bn_decay=bn_decay)\n",
    "            loss = get_loss(pred, labels_pl)\n",
    "            tf.summary.scalar('loss', loss)\n",
    "\n",
    "            correct = tf.equal(tf.argmax(pred, 2), tf.to_int64(labels_pl))\n",
    "            accuracy = tf.reduce_sum(tf.cast(correct, tf.float32)) / float(BATCH_SIZE*NUM_POINT)\n",
    "            tf.summary.scalar('accuracy', accuracy)\n",
    "\n",
    "            # Get training operator\n",
    "            learning_rate = get_learning_rate(batch)\n",
    "            tf.summary.scalar('learning_rate', learning_rate)\n",
    "            if OPTIMIZER == 'momentum':\n",
    "                optimizer = tf.train.MomentumOptimizer(learning_rate, momentum=MOMENTUM)\n",
    "            elif OPTIMIZER == 'adam':\n",
    "                optimizer = tf.train.AdamOptimizer(learning_rate)\n",
    "            train_op = optimizer.minimize(loss, global_step=batch)\n",
    "            \n",
    "            # Add ops to save and restore all the variables.\n",
    "            saver = tf.train.Saver()\n",
    "            \n",
    "        # Create a session\n",
    "        config = tf.ConfigProto()\n",
    "        config.gpu_options.allow_growth = True\n",
    "        config.allow_soft_placement = True\n",
    "        config.log_device_placement = True\n",
    "        sess = tf.Session(config=config)\n",
    "\n",
    "        # Add summary writers\n",
    "        merged = tf.summary.merge_all()\n",
    "        train_writer = tf.summary.FileWriter(os.path.join(LOG_DIR, 'train'),\n",
    "                                  sess.graph)\n",
    "        test_writer = tf.summary.FileWriter(os.path.join(LOG_DIR, 'test'))\n",
    "\n",
    "        # Init variables\n",
    "        init = tf.global_variables_initializer()\n",
    "        sess.run(init, {is_training_pl:True})\n",
    "\n",
    "        ops = {'pointclouds_pl': pointclouds_pl,\n",
    "               'labels_pl': labels_pl,\n",
    "               'is_training_pl': is_training_pl,\n",
    "               'pred': pred,\n",
    "               'loss': loss,\n",
    "               'train_op': train_op,\n",
    "               'merged': merged,\n",
    "               'step': batch}\n",
    "\n",
    "        for epoch in range(MAX_EPOCH):\n",
    "            log_string('**** EPOCH %03d ****' % (epoch))\n",
    "            sys.stdout.flush()\n",
    "             \n",
    "            train_one_epoch(sess, ops, train_writer)\n",
    "            eval_one_epoch(sess, ops, test_writer)\n",
    "            \n",
    "            # Save the variables to disk.\n",
    "            if epoch % 10 == 0:\n",
    "                save_path = saver.save(sess, os.path.join(LOG_DIR, \"model.ckpt\"))\n",
    "                log_string(\"Model saved in file: %s\" % save_path)\n",
    "\n",
    "\n",
    "\n",
    "def train_one_epoch(sess, ops, train_writer):\n",
    "    \"\"\" ops: dict mapping from string to tf ops \"\"\"\n",
    "    is_training = True\n",
    "    \n",
    "    log_string('----')\n",
    "    current_data, current_label, _ = provider.shuffle_data(train_data[:,0:NUM_POINT,:], train_label) \n",
    "    \n",
    "    file_size = current_data.shape[0]\n",
    "    num_batches = file_size // BATCH_SIZE\n",
    "    \n",
    "    total_correct = 0\n",
    "    total_seen = 0\n",
    "    loss_sum = 0\n",
    "    \n",
    "    for batch_idx in range(num_batches):\n",
    "        if batch_idx % 100 == 0:\n",
    "            print('Current batch/total batch num: %d/%d'%(batch_idx,num_batches))\n",
    "        start_idx = batch_idx * BATCH_SIZE\n",
    "        end_idx = (batch_idx+1) * BATCH_SIZE\n",
    "        \n",
    "        feed_dict = {ops['pointclouds_pl']: current_data[start_idx:end_idx, :, :],\n",
    "                     ops['labels_pl']: current_label[start_idx:end_idx],\n",
    "                     ops['is_training_pl']: is_training,}\n",
    "        summary, step, _, loss_val, pred_val = sess.run([ops['merged'], ops['step'], ops['train_op'], ops['loss'], ops['pred']],\n",
    "                                         feed_dict=feed_dict)\n",
    "        train_writer.add_summary(summary, step)\n",
    "        pred_val = np.argmax(pred_val, 2)\n",
    "        correct = np.sum(pred_val == current_label[start_idx:end_idx])\n",
    "        total_correct += correct\n",
    "        total_seen += (BATCH_SIZE*NUM_POINT)\n",
    "        loss_sum += loss_val\n",
    "    \n",
    "    log_string('mean loss: %f' % (loss_sum / float(num_batches)))\n",
    "    log_string('accuracy: %f' % (total_correct / float(total_seen)))\n",
    "\n",
    "        \n",
    "def eval_one_epoch(sess, ops, test_writer):\n",
    "    \"\"\" ops: dict mapping from string to tf ops \"\"\"\n",
    "    is_training = False\n",
    "    total_correct = 0\n",
    "    total_seen = 0\n",
    "    loss_sum = 0\n",
    "    total_seen_class = [0 for _ in range(NUM_CLASSES)]\n",
    "    total_correct_class = [0 for _ in range(NUM_CLASSES)]\n",
    "    \n",
    "    log_string('----')\n",
    "    current_data = test_data[:,0:NUM_POINT,:]\n",
    "    current_label = np.squeeze(test_label)\n",
    "    \n",
    "    file_size = current_data.shape[0]\n",
    "    num_batches = file_size // BATCH_SIZE\n",
    "    \n",
    "    for batch_idx in range(num_batches):\n",
    "        start_idx = batch_idx * BATCH_SIZE\n",
    "        end_idx = (batch_idx+1) * BATCH_SIZE\n",
    "\n",
    "        feed_dict = {ops['pointclouds_pl']: current_data[start_idx:end_idx, :, :],\n",
    "                     ops['labels_pl']: current_label[start_idx:end_idx],\n",
    "                     ops['is_training_pl']: is_training}\n",
    "        summary, step, loss_val, pred_val = sess.run([ops['merged'], ops['step'], ops['loss'], ops['pred']],\n",
    "                                      feed_dict=feed_dict)\n",
    "        test_writer.add_summary(summary, step)\n",
    "        pred_val = np.argmax(pred_val, 2)\n",
    "        correct = np.sum(pred_val == current_label[start_idx:end_idx])\n",
    "        total_correct += correct\n",
    "        total_seen += (BATCH_SIZE*NUM_POINT)\n",
    "        loss_sum += (loss_val*BATCH_SIZE)\n",
    "        for i in range(start_idx, end_idx):\n",
    "            for j in range(NUM_POINT):\n",
    "                l = current_label[i, j]\n",
    "                total_seen_class[l] += 1\n",
    "                total_correct_class[l] += (pred_val[i-start_idx, j] == l)\n",
    "            \n",
    "    log_string('eval mean loss: %f' % (loss_sum / float(total_seen/NUM_POINT)))\n",
    "    log_string('eval accuracy: %f'% (total_correct / float(total_seen)))\n",
    "    log_string('eval avg class acc: %f' % (np.mean(np.array(total_correct_class)/np.array(total_seen_class,dtype=np.float))))\n",
    "         \n",
    "\n",
    "if __name__ == \"__main__\":\n",
    "    train()\n",
    "    LOG_FOUT.close()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python [conda env:3dvision]",
   "language": "python",
   "name": "conda-env-3dvision-py"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
